package ecom.appcode.business;

import java.util.List;

import ecom.appcode.common.daobean.CategoryDaoBean;
import ecom.appcode.dao.daointerface.CategoryDao;
import ecom.appcode.dao.daointerface.CategoryDaoImpl;

public class CategoryLogicImpl implements CategoryLogic {

    /** load all category */
    public List<CategoryDaoBean> loadCategoryName() {
        CategoryDao category = new CategoryDaoImpl();
        List<CategoryDaoBean> list = category.loadCategoryName();
        return list;
    }

    /** Load Category by ID */
    public CategoryDaoBean loadCategoryByID(int ID) {
        CategoryDao category = new CategoryDaoImpl();
        CategoryDaoBean list = category.loadCategoryByID(ID);
        return list;
    }

    /** Update Category */
    public boolean updateCategory(int categoryID, String categoryName, String description) {
        CategoryDao category = new CategoryDaoImpl();
        boolean result = category.updateCategory(categoryID, categoryName, description);
        return result;
    }

    /** Add New Category */
    public boolean addCategory(String categoryName, String description) {
        CategoryDao category = new CategoryDaoImpl();
        boolean result = category.addCategory(categoryName, description);
        return result;
    }

    /** Delete Category */
    public boolean deleteCategory(int categoryID) {
        CategoryDao category = new CategoryDaoImpl();
        boolean result = category.deleteCategory(categoryID);
        return result;
    }
}
